package work;

import enjoy.menpiao;

import java.util.Scanner;

public class Visitor {
    public String name;
    public int age;
    public int price;

    public void jiage() {
        Scanner input=new Scanner(System.in);
        String reply=null;
        do {
            System.out.print("请输入游客姓名");
            this.name=input.next();
            System.out.print("请输入游客年龄");
            this.age=input.nextInt();
            if (this.age>60){
                System.out.println(this.name+"的年龄为:"+this.age+"岁，老人票，门票免费");
            }else if (this.age>16&&this.age<=60){
                System.out.println(this.name+"的年龄为:"+this.age+"岁，成人票，门票30元");
            }else if (this.age>6&&this.age<=16){
                System.out.println(this.name+"的年龄为:"+this.age+"岁，优惠票，门票20元");
            }else {
                System.out.println(this.name+"的年龄为:"+this.age+"岁，儿童票，门票免费");
            }
            System.out.println("继续购票妈？输入y继续，输入n退出：");
            reply=input.next();
        }while ("y".equalsIgnoreCase(reply));
    }

    public static void main(String[] args) {
        menpiao xinxi=new menpiao();
        xinxi.jiage();
    }
}
